package com.whnk.attendance.controller;

import com.whnk.attendance.service.IMonthHumenStatisService;
import com.whnk.attendance.vo.MonthHumenListJsonVo;
import com.whnk.attendance.vo.MonthHumenQuery;
import com.whnk.common.core.web.controller.BaseController;
import com.whnk.common.core.web.domain.AjaxResult;
import com.whnk.common.log.annotation.Log;
import com.whnk.common.log.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 每月统计（人数汇总）Controller
 *
 * @author whnk
 * @date 2021-11-17
 */
@Api(tags = "每月统计（人数汇总）Controller")
@RestController
@RequestMapping("/monthHumenStatis")
public class MonthHumenStatisController extends BaseController
{
    @Autowired
    private IMonthHumenStatisService monthHumenStatisService;

    /**
     * 查询每月统计（人数汇总）列表
     */
    @ApiOperation(value = "查询每月统计（人数汇总）列表")
 //   @PreAuthorize(hasPermi = "attendance:statis:list")
    @GetMapping("/list")
    public AjaxResult list(MonthHumenQuery monthHumenQuery)
    {

        return AjaxResult.success(monthHumenStatisService.queryMonthStatis(monthHumenQuery));
    }

    /**
     * 导出每月统计（人数汇总）列表
     */
    @ApiOperation(value = "导出每月统计（人数汇总）列表")
  //  @PreAuthorize(hasPermi = "attendance:statis:export")
    @Log(title = "每月统计（人数汇总）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MonthHumenQuery monthHumenQuery) throws IOException
    {
        MonthHumenListJsonVo monthHumenListJsonVo = monthHumenStatisService.queryMonthStatis(monthHumenQuery);
        monthHumenStatisService.exportExcel(response,monthHumenListJsonVo);
    }

    /**
     * 获取每月统计（人数汇总）详细信息
     */
//    @PreAuthorize(hasPermi = "attendance:statis:query")
//    @GetMapping(value = "/{humenStatisId}")
//    public AjaxResult getInfo(@PathVariable("humenStatisId") Integer humenStatisId)
//    {
//        return AjaxResult.success(monthHumenStatisService.selectMonthHumenStatisByHumenStatisId(humenStatisId));
//    }

    /**
     * 新增每月统计（人数汇总）
     */
//    @PreAuthorize(hasPermi = "attendance:statis:add")
//    @Log(title = "每月统计（人数汇总）", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody MonthHumenStatis monthHumenStatis)
//    {
//        return toAjax(monthHumenStatisService.insertMonthHumenStatis(monthHumenStatis));
//    }

    /**
     * 修改每月统计（人数汇总）
     */
//    @PreAuthorize(hasPermi = "attendance:statis:edit")
//    @Log(title = "每月统计（人数汇总）", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody MonthHumenStatis monthHumenStatis)
//    {
//        return toAjax(monthHumenStatisService.updateMonthHumenStatis(monthHumenStatis));
//    }

    /**
     * 删除每月统计（人数汇总）
     */
//    @PreAuthorize(hasPermi = "attendance:statis:remove")
//    @Log(title = "每月统计（人数汇总）", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{humenStatisIds}")
//    public AjaxResult remove(@PathVariable Integer[] humenStatisIds)
//    {
//        return toAjax(monthHumenStatisService.deleteMonthHumenStatisByHumenStatisIds(humenStatisIds));
//    }
}
